package com.hzvdvmc.autosale.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.hzvdvmc.autosale.sale.ui.NetStateDialog;
import com.hzvdvmc.autosale.socket.event.CommonEvent;
import com.hzvdvmc.autosale.socket.manager.CmdRequestManager;
import com.hzvdvmc.autosale.util.NetworkUtils;
import com.hzvdvmc.autosale.util.ToastUtils;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by william on 2018/3/3.
 */

public class NetStateReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (!NetworkUtils.isConnected()) {
            ToastUtils.showShort("网络未连接");
            EventBus.getDefault().post(new CommonEvent(CommonEvent.NET_DISCONNET));
        } else {
            EventBus.getDefault().post(new CommonEvent(CommonEvent.NET_RECONNET));
        }
    }
}
